package com.zyf.spit.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zyf.spit.dao.CommentDao;
import com.zyf.spit.pojo.Comment;
import com.zyf.spit.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    CommentDao commentDao;

    public void add(Comment comment) {
        commentDao.add(comment);
    }
    public void delete(String id){
        commentDao.delete(id);
    }
    public PageInfo findContentByArticleId(String articleid,int pageNum,int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<String> contentByArticleId = commentDao.findContentByArticleId(articleid);
        PageInfo pageInfo=new PageInfo(contentByArticleId);
        return pageInfo;
    }
}
